<?php
/**
 * Registering meta boxes
 *
 * All the definitions of meta boxes are listed below with comments.
 * Please read them CAREFULLY.
 *
 * You also should read the changelog to know what has been changed before updating.
 *
 * For more information, please visit:
 * @link http://www.deluxeblogtips.com/meta-box/
 */

/********************* META BOX DEFINITIONS ***********************/

/**
 * Prefix of meta keys (optional)
 * Use underscore (_) at the beginning to make keys hidden
 * Alt.: You also can make prefix empty to disable it
 */

// Better has an underscore as last sign
$prefix = 'sd_';

global $meta_boxes;

$meta_boxes = array();

//Pages meta box

$meta_boxes[] = array(
	'id' => 'page_options',
	'title' => 'Page header background image',
	'pages' => array( 'page', 'post' ),
	'context' => 'normal',

	'fields' => array(


		array(
			'name'		=> 'Custom Header Page Background',
			'desc'		=> 'Upload your custom header page background (optimal size 960x94 for full image)',
			'id'		=> $prefix . "header_page_bg",
			'type'		=> 'plupload_image',
			'max_file_uploads' => 1,
		),

		array(
			'name'		=> 'Background No Repeat',			// checkbox
			'id'		=> $prefix . "no_repeat",
			'type'		=> 'checkbox',
			'std'		=> '0',
			'desc'		=> 'Header background no repeat'
		),
		array(
			'name' => 'Background Repeat Horizontally',			// checkbox
			'id'		=> $prefix . "repeat_x",
			'type'		=> 'checkbox',
			'std'		=> '0',
			'desc'		=> 'Header background repeat horizontaly'
		),
		array(
			'name'		=> 'Background Repeat Vertically',			// checkbox
			'id'		=> $prefix . "repeat_y",
			'type'		=> 'checkbox',
			'std'		=> '0',
			'desc'		=> 'Header background repeat vertically'
		)
	)
);

/********************* META BOX REGISTERING ***********************/

/**
 * Register meta boxes
 *
 * @return void
 */
function sd_register_meta_boxes()
{
	// Make sure there's no errors when the plugin is deactivated or during upgrade
	if ( !class_exists( 'RW_Meta_Box' ) )
		return;

	global $meta_boxes;
	foreach ( $meta_boxes as $meta_box )
	{
		new RW_Meta_Box( $meta_box );
	}
}
// Hook to 'admin_init' to make sure the meta box class is loaded before
// (in case using the meta box class in another plugin)
// This is also helpful for some conditionals like checking page template, categories, etc.
add_action( 'admin_init', 'sd_register_meta_boxes' );